package com.weight.system.project.service.impl;

import com.weight.system.project.PO.ProjectInfo;
import com.weight.system.project.service.ProjectInfoService;
import com.weight.system.project.DAO.ProjectInfoMapper;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import org.springframework.transaction.annotation.Transactional;
import com.weight.common.util.CommonUtils;
import lombok.extern.slf4j.Slf4j;

/**
 * 项目信息表
 */
@Service
@Transactional
@Slf4j
public class ProjectInfoServiceImpl implements ProjectInfoService {

	@Autowired
	private ProjectInfoMapper projectInfoMapper;


	/**
	 * 查询项目信息信息--条件查询
	 * @param map
	 * @return
	 */
	@Override
	public List<ProjectInfo> findProjectInfoByT(Map map){
		return projectInfoMapper.findProjectInfoByT(map);
	}

	/**
	 * 查询项目信息信息--条件，分页查询
	 * @param currentPage
	 * @param pageSize
	 * @param map
	 * @return
	 */
	@Override
	public List<ProjectInfo> findProjectInfoByPage(int currentPage,int pageSize,Map map){
		PageHelper.startPage(currentPage, pageSize);
		List<ProjectInfo> projectInfoList = projectInfoMapper.findProjectInfoByT(map);
		return projectInfoList;
	}

	/**
	 * 查询项目信息信息--查询全部
	 * @return
	 */
	@Override
	public List<ProjectInfo> findAll(){
		return projectInfoMapper.findAll();
	}

	/**
	 * ID查询项目信息信息
	 * @param map
	 * @return
	 */
	@Override
	public ProjectInfo findByProjectInfoId(Map map){
		ProjectInfo projectInfo=projectInfoMapper.findByProjectInfoId(map);
		CommonUtils.validateExistObj(projectInfo,map);
		return projectInfo;
	}

	/**
	 * ID查询项目信息信息-批量
	 * @param projectInfoIdList
	 * @return
	 */
	@Override
	public List findByProjectInfoIdList(List projectInfoIdList){
		List idList = projectInfoMapper.findByProjectInfoIdList(projectInfoIdList);
		CommonUtils.validateExistList(idList,projectInfoIdList);
		return idList;
	}

	/**
	 * 添加项目信息
	 * @param projectInfo
	 */
	@Override
	public void insertProjectInfo(ProjectInfo projectInfo){
		projectInfoMapper.insertProjectInfo(projectInfo);
	}

	/**
	 * 批量添加项目信息
	 * @param projectInfoList
	 */
	@Override
	public void insertProjectInfoBatch(List<ProjectInfo> projectInfoList){
		projectInfoMapper.insertProjectInfoBatch(projectInfoList);
	}

	/**
	 * 修改项目信息
	 * @param projectInfo
	 */
	@Override
	public void updateProjectInfo(ProjectInfo projectInfo){
		projectInfoMapper.updateProjectInfo(projectInfo);
	}

	/**
	 * 物理删除项目信息
	 * @param map
	 */
	@Override
	public void deleteByProjectInfoId(Map map){
		projectInfoMapper.deleteByProjectInfoId(map);
	}

	/**
	 * 批量物理删除项目信息
	 * @param projectInfoIdList
	 */
	@Override
	public void deleteByProjectInfoIdBatch(List projectInfoIdList){
		projectInfoMapper.deleteByProjectInfoIdBatch(projectInfoIdList);
	}

	/**
	 * 状态删除项目信息
	 * @param map
	 */
	@Override
	public void upDelByProjectInfoId(Map map){
		projectInfoMapper.upDelByProjectInfoId(map);
	}

	/**
	 * 批量状态删除项目信息
	 * @param projectInfoList
	 */
	@Override
	public void upDelByProjectInfoIdBatch(Map<String, Object> map){
		projectInfoMapper.upDelByProjectInfoIdBatch(map);
	}

}